﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package validation.util {
    import flash.utils.*;
    import Classes.*;
    import Classes.LogicComponents.*;
    import validation.*;

    public class MapResourceValidationUtil implements IValidationUtilClass {

        protected var m_validators:Dictionary;

        public function MapResourceValidationUtil(){
            this.loadValidators();
        }
        public function getValidationCallback(_arg1:String):Function{
            return (this.m_validators[_arg1]);
        }
        protected function loadValidators():void{
            this.m_validators = new Dictionary();
            this.m_validators["checkState"] = function (_arg1:Object):Boolean{
                var _local2:String = _arg1.check;
                var _local3:String = _arg1.checkNot;
                var _local4:Boolean = ((!(_local2)) || (((this as MapResource).getState() == _local2)));
                var _local5:Boolean = ((!(_local3)) || (!(((this as MapResource).getState() == _local3))));
                return (((_local4) && (_local5)));
            };
            this.m_validators["isUpgradable"] = function (_arg1:Object):Boolean{
                var _local5:MunicipalComponentBase;
                var _local2 = !((_arg1.value == "false"));
                var _local3:Municipal = (this as Municipal);
                var _local4:Boolean = (this as MapResource).isUpgradePossible();
                if (_local3){
                    _local5 = _local3.getLogicComponent();
                    _local4 = ((_local4) && (_local5.passesExperimentGate()));
                };
                return ((_local4 == _local2));
            };
        }

    }
}//package validation.util 
